var publishInfo = {
	init : function(){
		publishInfo.publishEventBind();
		publishInfo.showFace();
		publishInfo.showPicTools();
		publishInfo.initPagination();
		publishInfo.getPageData(1,10);
	},
	publishEventBind : function(){
		$("#publish_btn").bind('click',function(){
			publishInfo.publish();
		});
	},
	publish : function(){
		var ajax_option={
				url  : "/web/publishInfo/publishInfo",
				type : "post",
				dataType : "json", 
				success:function(data){
					console.log(data);
				}
			};
			
			$("#publishForm").ajaxSubmit(ajax_option);
	},
	showFace : function(){
//		//放新浪微博表情
        $("#message_face").jqfaceedit({txtAreaObj:$("#text"),containerObj:$('#container'),top:25,left:-27});
		//显示表情
//		 $("#show_face").click(function(){
//			$('.show_e').html($('#text').val());
//			$('.show_e').emotionsToHtml();
//		 });
	},
	showPicTools : function(){
		$("#message_pic").jqpictools({txtAreaObj:$("#text"),containerObj:$('#container'),top:25,left:-27});
	},
	initPagination : function(){
//		 class="easyui-pagination" data-options="total:114"
		$('#epp').pagination({
		    total : total,
		    pageSize:10,
		    onSelectPage:function(pageNumber, pageSize){
				publishInfo.getPageData(pageNumber, pageSize);
			},    
	       onSelectPage:function(pageNumber,pageSize){    
	    	   publishInfo.getPageData(pageNumber, pageSize);
	        }    
		});
	},
	getPageData : function(pageNumber,pageSize){
		$.ajax({
			type: "GET",
			url: "/web/publishInfo/getUserPublishInfo?pageSize=" + pageSize + "&pageNumber=" + pageNumber,
			dataType: "json",
			success: function(data) {
				if(data && data.publishInfos){
					var html = [];
					$.each(data.publishInfos,function(index,data){
						html.push('<dl id="desc">');
						html.push('<dd>');
						html.push(data.text);
						html.push('</dd>');
						html.push('<dd class="ta-r"></dd>');
						html.push('</dl>');
					});
					$("#desc_list").html(html.join(''));
				}
				//pagination.pagination('loaded');
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) {
				alert("网络错误");
			}
		});
	}
};